import {
	createRouter,
	createWebHistory
} from 'vue-router'
import Layout from '/src/layout/Layout.vue'
import user from "@/views/User"
const routes = [{
	path: '/',
	name:Layout,
	component: Layout,
	redirect:"/user",
	children:[
		{
			path:'user',
			name:'User',
			component:() =>import("@/views/User"),
		},
		{
			path:'book',
			name:'Book',
			component:() =>import("@/views/Book"),
		},
		{
			path:'news',
			name:'News',
			component:() =>import("@/views/News"),
		},
		{
			path:'person',
			name:'Person',
			component:() =>import("@/views/Person"),
		}
	]
	},
	{
		path: '/login',
		name: 'Login',
		//懒加载
		component: () => import("@/views/Login"),
	},
	{
		path: '/register',
		name: 'Register',
		component: () => import("@/views/Register"),
	},
]

const router = createRouter({
	history: createWebHistory(process.env.BASE_URL),
	routes
})

export default router
